package com.anuo.java;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class IOStudy {
	public static void main(String args[]) {

	}

	public static void FileInOutStream() {
		FileInputStream in = null;
		FileOutputStream out = null;
		try {
			in = new FileInputStream("F:\\java\\hw.java");
			out = new FileOutputStream("F:\\java\\helloworld.java");
			int b = 0;
			while ((b = in.read()) != -1) {
				out.write(b);
			}
			in.close();
			out.close();
		} catch (FileNotFoundException e) {
			System.out.println("文件没有找到!");
			System.exit(-1);
		} catch (IOException io) {
			System.out.println("文件复制出错!错误为:" + io.getMessage());
			System.exit(-1);
		}
		System.out.println("文件复制成功!");
	}

}
